home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / utilities / comsuite 95 / COMMSUIT / DELPHI.C_ / DELPHI.C
Encoding:
C/C++ Source or Header  |  1993-11-12  |  2.9 KB  |  99 lines

  1. /* This program delphi.c created by Delrina and assigned to the Delphi session */
  2. /* runs an automated logon script for connecting to Delphi.                      */
  3.  
  4. /*    $Revision:   1.2  $               */
  5. /*    $Date:   27 Oct 1995 14:42:42  $  */
  6.  
  7. /* Define main function, which is always the starting point of C programs. */
  8. /* (The term "void" indicates that the function returns no value.)         */
  9. void main()
  10. {
  11.     /* Declare variables */
  12.     long ScriptHandle;
  13.     int ReturnValue;
  14.     char Buffer[128];
  15.  
  16.     /* Initialize variables */
  17.     ReturnValue = 0;
  18.     ScriptHandle = 0;
  19.  
  20.     /* Establish a link between this script program and Delrina WinComm PRO */
  21.     ScriptHandle = dcInitialize(0,0,0,0);
  22.  
  23.     /* Exit if intialization of link with Delrina WinComm PRO failed */
  24.     if (ScriptHandle == 0) exit();
  25.  
  26.     /* Type a '@' then <enter> */
  27.     if (ReturnValue >= 0)
  28.         ReturnValue = dcTypeText(ScriptHandle, 0, "@");
  29.  
  30.     /* Pause */
  31.     if (ReturnValue >= 0)
  32.         dcSleep(ScriptHandle, 1000L);
  33.  
  34.     /* Type a  <enter> */
  35.     if (ReturnValue >= 0)
  36.         ReturnValue = dcTypeText(ScriptHandle, 0, "\r");
  37.  
  38.     /* Wait for one of three prompts possible with Tymenet or Telenet */
  39.     if (ReturnValue >= 0)
  40.         ReturnValue = dcWaitForPrompt(ScriptHandle, 3, "ERMINAL=\0r name: \0identifier", 300L, 32000L);
  41.  
  42.     /* If Tymenet do this block */
  43.     if (ReturnValue == 0)
  44.         {
  45.         /* Type an <enter> */
  46.         ReturnValue = dcTypeText(ScriptHandle, 0, "\r");
  47.  
  48.         /* Wait for a prompt */
  49.         if (ReturnValue >= 0)
  50.             ReturnValue = dcWaitForPrompt(ScriptHandle, 1, "\r\n\r\n@", 300L, 32000L);
  51.  
  52.         /* Type text to request Delphi */
  53.         if (ReturnValue >= 0)
  54.             ReturnValue = dcTypeText(ScriptHandle, 0, "c delphi\r");
  55.         }
  56.     /* If Telenet do this block */
  57.     else
  58.         {
  59.         /* Type an 'o' */
  60.         ReturnValue = dcTypeText(ScriptHandle, 0, "o");
  61.  
  62.         /* Wait for a prompt */
  63.         if (ReturnValue >= 0)
  64.             ReturnValue = dcWaitForPrompt(ScriptHandle, 1, "log in: ", 300L, 32000L);
  65.  
  66.         /* Type text requesting Delphi */
  67.         if (ReturnValue >= 0)
  68.             ReturnValue = dcTypeText(ScriptHandle, 0, "delphi\r");
  69.         }
  70.  
  71.     /* Wait for a prompt */
  72.     if (ReturnValue >= 0)
  73.         ReturnValue = dcWaitForPrompt(ScriptHandle, 1, "ername: ", 300L, 32000L);
  74.  
  75.     /* Get User Name from Runtime Values dialog box */
  76.     if (ReturnValue >= 0)
  77.         ReturnValue = dcGetRuntimeValue(ScriptHandle, 1, 1, 128, Buffer);
  78.  
  79.     /* Type the value */
  80.     if (ReturnValue >= 0)
  81.         ReturnValue = dcTypeText(ScriptHandle, 0, Buffer);
  82.  
  83.     /* Wait for a prompt */
  84.     if (ReturnValue >= 0)
  85.         ReturnValue = dcWaitForPrompt(ScriptHandle, 1, "ssword: ", 300L, 32000L);
  86.  
  87.     /* Get Password value from Runtime Values dialog box */
  88.     if (ReturnValue >= 0)
  89.         ReturnValue = dcGetRuntimeValue(ScriptHandle, 3, 1, 128, Buffer);
  90.  
  91.     /* Type the value */
  92.     if (ReturnValue >= 0)
  93.         ReturnValue = dcTypeText(ScriptHandle, 0, Buffer);
  94.  
  95.     /* Terminate link between Delrina WinComm PRO and script program */
  96.     dcTerminate(ScriptHandle, 0);
  97. }
  98.  
  99.